package com.systop.busafter.bus.mapper;

import com.systop.commer.pojo.Bus;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BusMapper {
    /*
     * 修改bus
     * bus bus
     * return int
     * csh
     * */
    @Update("update bus set bus_name = #{bus_name},bus_year = #{bus_year},bus_seat = #{bus_seat},bus_photo = #{bus_photo},bus_price = #{bus_price},bus_coupon = #{bus_coupon},bus_state = #{bus_state},bus_remarks = #{bus_remarks},bus_s = #{bus_s} where bus_id = #{bus_id}")
    int updatabus(Bus bus);


    //"time = #{time,jdbcType=TIMESTAMP} "  时间类型

    /*
     * 添加bus
     * bus bus
     * return int
     * csh
     * */
    @Insert("insert into bus(bus_name,bus_year,bus_seat,bus_photo,bus_price,bus_coupon,bus_state,bus_driver_id,bus_remarks,bus_s) values (#{bus_name},#{bus_year}," +
            "#{bus_seat},#{bus_photo},#{bus_price},#{bus_coupon},#{bus_state},#{bus_driver_id},#{bus_remarks},#{bus_s})")
    int insertbus(Bus bus);



    /*
     * 查看全部
     * 无
     * list
     * csh
     * */
    @Select("select * from bus")
    List<Bus> busListall();

    /*
     * 用id查看bus
     * bus_id  int
     * list
     * csh
     * */
    @Select("select * from bus where bus_id = #{bus_id}")
    List<Bus> busIdlist(int bus_id);

    /*
     * 用id查看bus
     * bus_id  int
     * 实体类
     * csh
     * */
    @Select("select * from bus where bus_id = #{bus_id}")
    Bus BusId(int bus_id);

    /*
     * 删除bus
     * bus_id  int
     * return int
     * csh
     * */
    @Delete("delete from bus where bus_id=#{bus_id}")
    int deletebus(int bus_id);

    /*
     * 用车主id查看bus
     * bus_driver_id  int
     * list
     * csh
     * */
    @Select("select * from bus where bus_driver_id = #{bus_driver_id}")
    List<Bus> driverIdall(int bus_driver_id);

    /*
     * 用价格查看bus
     * bus_price  float
     * list
     * csh
     * */
    @Select("select * from bus where bus_price = #{bus_price}")
    List<Bus> buspriceall (float bus_price);

    /*
     * 用优惠卷查查看bus
     * bus_price  float
     * list
     * csh
     * */
    @Select("select * from bus where bus_coupon = #{bus_coupon}")
    List<Bus> buscouponall (float bus_coupon);

    /*
     * 用状态查看bus
     * bus_price  float
     * list
     * csh
     * */
    @Select("select * from bus where bus_state = #{bus_state}")
    List<Bus> busstateall (int bus_state);


    /*
     * 用状态查看bus
     * bus_price  float
     * list
     * csh
     * */
    @Select("select * from bus where bus_s = #{bus_s}")
    List<Bus> busdrivername (String bus_s);



}
